<?php

function assos_get_list_idtheme_video() {
	$sql = 'SELECT DISTINCT ID_theme FROM `assos_v-t`;';
	return query($sql);
}

function assos_get_list_idvideos($id,$page=0) {
	$sql = 'SELECT ID_video FROM `assos_v-t` WHERE ID_theme='.$id;
	if ($page==0){
			$sql.=';';
		}
		else{
			$init=10*$page-9;
			$sql.=" LIMIT $init,10;";
		}
	return query($sql);
}
function insert_video_theme($id_theme, $id_video){
	$sql = "INSERT INTO `assos_v-t` VALUES ('$id_video', '$id_theme');";
    return query($sql);
}

function delete_video_and_theme($id_theme, $id_video){
	$sql = "DELETE FROM `assos_v-t` WHERE ID_video = '$id_video' AND ID_theme = '$id_theme' ;";
    return query($sql);
}

function delete_video_theme($id){
	$sql = 'DELETE FROM `assos_v-t` WHERE ID_video ='.$id.';';
	return query($sql);
}

function delete_theme_v($id){
	$sql = 'DELETE FROM `assos_v-t` WHERE ID_theme ='.$id.';';
	return query($sql);
}